Skip to content

Comments

16. Переписывание контрольных № 2 (143)#5

Open
imaxde wants to merge 2 commits intomainfrom
rewrite2
Open

16. Переписывание контрольных № 2 (143)#5
imaxde wants to merge 2 commits intomainfrom
rewrite2

Conversation

@imaxde
Copy link
Owner

@imaxde imaxde commented Dec 18, 2025

No description provided.

@imaxde imaxde requested a review from WoWaster December 18, 2025 15:42
Copy link
Collaborator

@WoWaster WoWaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Попахивает нейронкой, но ладно

size_t capacity;
};

int reserve(struct Vector* vector, size_t new_capacity)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще странный выбор кода возврата, если бывает bool.


int reserve(struct Vector* vector, size_t new_capacity)
{
void** new_data;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не по кодстайлу

Comment on lines +18 to +19
if (!new_data)
return -1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Коды возврата стоит описывать в хедере


vector->data = NULL;
vector->size = 0;
vector->capacity = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну, честно говоря, начальный capacity лучше делать не 0.

return vector;
}

void deleteVector(struct Vector* vector)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не очень понимаю, что пользователь должен делать со своими данными. Чистить сам? Это нужно было описать.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Самая главная проблема --- нет описания стратегии владения. Я не понимаю, что должен делать пользователь, чтобы у него не текла память

Comment on lines +9 to +11
struct Vector* reliable;
size_t i;
size_t n;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ой, а это зачем, ещё и не инициализированное?

Comment on lines +42 to +48
size_t n;
size_t i;
size_t count;
double sumSignal;
uint8_t maxSignal;
size_t maxId;
int hasMax;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь такой же вопрос. Особенно много вопросов, зачем выносить i наверх

sumSignal = 0.0;
maxSignal = 0;
maxId = 0;
hasMax = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему не bool?

Comment on lines +84 to +87
if (count == 0) {
printf("No reliable points to analyze.\n");
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Такое правда может случиться?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants